package com.mika.music.service;

import com.mika.music.mapper.MusicMapper;
import com.mika.music.model.Music;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MusicService {
    @Autowired
    private MusicMapper musicMapper;

    public Integer addMusic(Music music) {
        return musicMapper.insert(music);
    }

    // 查询没被删除的音乐
    public Music getSongByName(String title) {
        return musicMapper.getSongByName(title);
    }


    public Integer deleteById(Integer id) {
        return musicMapper.deleteById(id);
    }

    public Integer deleteByIds(List<Integer> ids) {
        return musicMapper.deleteByIds(ids);
    }

    public List<Music> getMusics() {
        return musicMapper.getMusics();
    }

    public List<Music> getMusicsByName(String musicName) {
        return musicMapper.getMusicsByName(musicName);
    }

    public Music getMusicById(Integer id) {
        return musicMapper.getMusicById(id);
    }

    public List<Music> getMusicsByIds(List<Integer> id) {
        return musicMapper.getMusicsByIds(id);
    }

    public List<Music> getLast100ListenedMusic(Integer userId) {
        return musicMapper.getLast100ListenedMusic(userId);
    }

    public List<Music> getHighViewCountMusicByLabelName(String labelName) {
        return musicMapper.getHighViewCountMusicByLabelName(labelName);
    }

    public List<Music> getMusicsNotInMusicIds(List<Integer> ids) {
        return musicMapper.getMusicsNotInMusicIds(ids);
    }

    public List<Music> getMusicsNotInMusicIdsAndTitleLike(List<Integer> ids, String title) {
        return musicMapper.getMusicsNotInMusicIdsAndTitleLike(ids, title);
    }
}
